package yyx;

import java.util.Random;
//皇帝
public class Emperor{
	String name;
	int age;
	int prestige;
	float money;
	int health;
	
	 public Emperor(String name, int age, int prestige, int money, int health) {
	        this.name = name;
	        this.age = age;
	        this.prestige = prestige;
	        this.money = money;
	        this.health = health;
	    }
	
	public void showInfo() {
		System.out.println("皇帝的姓名为"+name);
		System.out.println("皇帝的年龄为"+age);
		System.out.println("皇帝的威望为"+prestige);
		System.out.println("皇帝的金钱为"+money);
		System.out.println("皇帝的健康为"+health);
	}
	
	public void getSick() {
		String[] diseases = {"感冒", "发烧", "新冠","甲流"};
        Random random = new Random();
        //选出什么病
        int index = random.nextInt(diseases.length);
        String disease = diseases[index]; 
        //生成一个1-20的随机数来代表严重程度
        int severity = random.nextInt(20) + 1;

        health -= severity;

        System.out.println("皇帝得的疾病叫" + disease);
        System.out.println("该病的严重程度为" + severity);
        System.out.println("皇帝的健康为" + severity);
	}
}